home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************************
- * *
- * XTNDTextTranslator.h *
- * *
- * Header file for text translators. *
- * *
- * Copyright © 1989-91 Claris Corporation *
- * All Rights Reserved *
- * *
- ********************************************************************************/
-
- #ifndef __XTNDTEXTTRANSLATOR__
- #define __XTNDTEXTTRANSLATOR__
-
-
- #include "XTNDInterface.h"
- #include <Printing.h>
-
- /* Defines for Directive to be passed to import translators */
- enum ImportDirectives
- {
- importAcknowledge = -1, /* Value set by a translator to acknowledge an action */
-
- importGetResources,
- importInitAll,
-
- importInitRightHeader,
- importInitLeftHeader,
- importInitHeader,
-
- importInitRightFooter,
- importInitLeftFooter,
- importInitFooter,
-
- importInitMain,
-
- importInitFootnote,
-
- importGetText,
-
- importCloseRightHeader,
- importCloseLeftHeader,
- importCloseHeader,
-
- importCloseRightFooter,
- importCloseLeftFooter,
- importCloseFooter,
-
- importCloseMain,
-
- importCloseFootnote,
-
- importCloseAll
- };
-
-
- /* Defines for Directive to be passed to export translators */
- enum ExportDirectives
- {
- exportAcknowledge = -1, /* Value set by a translator to acknowledge an action */
-
- exportInitAll,
-
- exportOpenRightHeader,
- exportOpenLeftHeader,
- exportOpenHeader,
-
- exportOpenRightFooter,
- exportOpenLeftFooter,
- exportOpenFooter,
-
- exportOpenFootnote,
-
- exportOpenMain,
-
- exportWriteText,
-
- exportCloseRightHeader,
- exportCloseLeftHeader,
- exportCloseHeader,
-
- exportCloseRightFooter,
- exportCloseLeftFooter,
- exportCloseFooter,
-
- exportCloseFootnote,
-
- exportCloseMain,
-
- exportCloseAll,
-
- exportWriteResources
- };
-
-
- /* Defines for CurrentStory */
- #define rightHeaderStory 1
- #define leftHeaderStory 2
- #define headerStory 3
- #define rightFooterStory 4
- #define leftFooterStory 5
- #define footerStory 6
- #define footnoteStory 7
- #define mainStory 8
-
-
- /* Defines for header/footer pages */
- #define everyPage 1
- #define leftPage 2
- #define rightPage 4
-
-
- /* XTND 1.x special characters */
- #define pageNumber 0x02 /* Current page number character */
- #define footnoteChar 0x03 /* Footnote character in the footnote */
- #define floatingPict 0x04 /* Floating picture marker */
- #define footnoteMark 0x05 /* Footnote character in the text */
- #define mergeBreak 0x06 /* Mail merge document break */
- #define hardReturn 0x07 /* Hard return (does not create new paragraph) */
- #define tabChar 0x09 /* Tab character */
- #define newColumn 0x0B /* Column break character */
- #define newPage 0x0C /* Page break character */
- #define returnChar 0x0D /* Paragraph break character */
- #define shortDateChar 0x15 /* Assorted date characters */
- #define abbrDateChar 0x16
- #define longDateChar 0x17
- #define dayAbbrDateChar 0x18 /* Date characters with day of week included */
- #define dayLongDateChar 0x19
- #define timeChar 0x1A /* Time character */
- #define softHyphen 0x1F /* Discretionary hyphen character */
-
- /* Other character values */
- #define enterChar 0x03
-
-
- /* XTND 1.x limits */
- #define numParaFmts 9 /* Number of fields in a paragraph specification */
- #define maxCols 10 /* Maximum number of columns allowed */
- #define maxTabs 20 /* Maximum number of tabs allowed */
- #define minGutter (0x00030000) /* (minimum gutter) 3 points as a Fixed number */
- #define maxGutter (0x01200000) /* (maximum gutter) 288 points as a Fixed number */
- #define dfltGutter (0x00090000) /* (default gutter) 9 points as a Fixed number */
-
-
- /* XTND 1.x text styles */
- #define textPlain 0x00
- #define textSuperScript 0x20
- #define textSubScript 0x40
- #define textNonbreaking 0x80
- #define textSuperior 0x100
- #define textStrikeThru 0x200
- #define textAllCaps 0x400
- #define textSmallCaps 0x800
- #define textWordUnderline 0x1000
- #define textDoubleUnderline 0x2000
- #define textLowerCase 0x4000
-
-
- /* XTND 1.x justification/tab alignment values */
- #define textLeft 0
- #define textCenter 1
- #define textRight 2
- #define textJustified 3 /* For text */
- #define textDecimal 3 /* For tabs */
-
-
- /* XTND 1.x text color values */
- #define textWhite 0
- #define textBlack 1
- #define textRed 2
- #define textGreen 3
- #define textBlue 4
- #define textCyan 5
- #define textMagenta 6
- #define textYellow 7
- #define textOtherColor 8
-
-
- /* —————— T Y P E D E F I N I T I O N S —————— */
-
- /* Tab specifications record. The tab array contains 20 of these */
- struct TabSpec
- {
- unsigned char tabJust; /* Tab justification (left, right, center, aligned) */
- unsigned char tabLead; /* Tab leader character (default is space) */
- Fixed tabIndent; /* Tab indent in points from left page margin */
- unsigned char decAlign; /* Tab alignment character (usually period) */
- };
- typedef struct TabSpec TabSpec;
- typedef TabSpec TabSpecArray[20];
-
-
- /* The PictMisc data structure is used to import a quickdraw picture */
- struct PictMisc
- {
- PicHandle thePicture; /* handle to the quickdraw picture */
- long pictSize; /* Size of associated picture */
- Rect destRect; /* Used for scaling the picture, OrigRect will be scaled to this rect */
- Rect origRect; /* Used for cropping the picture, pictRect will be cropped to this rect */
- char reserved[38]; /* Reserved, fill with zeros */
- };
- typedef struct PictMisc PictMisc;
- typedef PictMisc *PictMiscPtr, **PictMiscHdl;
-
- /* Paragraph format record. The ParaFormats array contains 9 Fixed values */
- typedef Fixed ParaFormat;
- typedef ParaFormat ParaFormats[9];
-
- /* This is the parameter block for passing information to an import translator */
- struct ImportParmBlock
- {
- Ptr textBuffer; /* Pointer to 256 bytes of data */
- short directive; /* Indicates the action to be performed */
- OSErr result; /* Return code, 0 if successful, error code otherwise */
- long textLength; /* Number of characters of information being returned */
- short translatorState;/* Available for use by the translator */
- short refNum; /* Reference number of the fork to be read by the translator */
- short txtFace; /* Current text face */
- short txtSize; /* Current text font size */
- short txtFont; /* Current text font family number */
- short txtColor; /* Current text color (XTND 1.x color value) */
- short txtJust; /* Justification of this text */
- short unused1; /* Must be zero */
- ParaFormat *paraFmts; /* Pointer to this paragraph's format array */
- TabSpec *tabs; /* Pointer to this paragraph's tab array */
- Boolean unused2; /* Currently unused */
- char numCols; /* Number of columns expected */
- short currentStory; /* Header,Footer,Main Body, etc. */
- long miscData; /* For importing pictures, etc. */
- short storyHeight; /* Height of header,footer, etc. */
- unsigned char decimalChar; /* Default char to align decimal tab on */
- Boolean autoHyphenate; /* If TRUE, auto hyphenation is on */
- THPrint printRecord; /* Print record, if one is used, otherwise zero*/
- Fixed topMargin; /* Document top margin */
- Fixed bottomMargin; /* Document bottom margin */
- Fixed leftMargin; /* Document left margin */
- Fixed rightMargin; /* Document right margin */
- Fixed gutter; /* Space between columns */
- short startPageNum; /* Starting page number */
- short startFootnoteNum; /* starting footnote number */
- StringPtr footnoteText; /* If not empty, text associated with footnote, else atuo */
- Boolean rulerShowing; /* If TRUE, ruler is showing */
- Boolean doubleSided; /* If TRUE, document has Left/Right pages */
- Boolean titlePage; /* If TRUE, document has a title page (with no headers/footers) */
- Boolean endnotes; /* If TRUE, footnotes are displayed as endnotes */
- Boolean showInvisibles; /* If TRUE, invisible characters will be displayed */
- Boolean showPageGuides; /* If TRUE, page guides will be displayed */
- Boolean showPictures; /* If TRUE, pictures will be displayed */
- Boolean autoFootnotes; /* If TRUE, footnotes will be numbered automatically */
- Point pagePoint; /* Position for page number within header/footer */
- Point datePoint; /* Position for date character within header/footer */
- Point timePoint; /* Position for time character within header/footer */
- Handle globalHandle; /* Handle to translator globals, if needed */
- Boolean smartQuotes; /* If TRUE, smart quotes will be used */
- Boolean fractCharWidths;/* If TRUE, fractional character widths will be used */
- short hRes; /* The horizontal resolution of this document (default is 72) */
- short vRes; /* The vertical resolution of this document (default is 72) */
- Rect windowRect; /* May be used to specify document window placement and size */
- SFReply theReply; /* Standard reply record describing the file being translated */
- TransDescribe thisTranslator; /* TransDescribe record describing this translator */
- };
- typedef struct ImportParmBlock ImportParmBlock;
- typedef ImportParmBlock *ImportParmBlkPtr;
-
- /* This is the parameter block for passing information to an export translator */
- struct ExportParmBlock
- {
- char directive; /* Indicates the action to be performed */
- OSErr *result; /* Pointer to return code, 0 if successful, error code otherwise */
- short *refNum; /* Pointer to reference number of the file being written by the translator */
- long *textLength; /* Pointer to number of characters being exported */
- Handle globalHandle; /* Handle to translator globals, if needed */
- long reserved1; /* Do not change this value */
- Handle textBuffer; /* Handle to the text being exported */
- short *txtFace; /* Pointer to the current text face */
- short *txtSize; /* Pointer to the current text font size */
- short *txtFont; /* Pointer to the current text font family number */
- char *txtColor; /* Pointer to the current text color (XTND 1.x color value) */
- short *txtJust; /* Pointer to the justification of this text */
- ParaFormat *paraFmts; /* Pointer to this paragraph's format array */
- TabSpec *tabs; /* Pointer to this paragraph's tab array */
- PicHandle thePicture; /* Handle to a quickdraw picture */
- Rect pictRect; /* Rectangle describing the display rect of the above picture */
- short headerStatus; /* Shows if header is on left/right/every page */
- short footerStatus; /* Shows if footer is on left/right/every page */
- short currentStory; /* Header, Footer, Main Body, etc. */
- short numCols; /* Number of columns in document */
- Fixed topMargin; /* Document top margin */
- Fixed bottomMargin; /* Document bottom margin */
- Fixed leftMargin; /* Document left margin */
- Fixed rightMargin; /* Document right margin */
- Fixed gutter; /* Space between columns */
- long totalCharCount; /* Total number of chars in document (for Word 3.0) */
- long footnoteOffset; /* If current story is a footnote, its offset in doc */
- StringPtr footnoteText; /* If !autoFootnotes, text for footnote (Pascal String) */
- short startPageNum; /* Starting page number */
- short startFootnoteNum; /* Starting footnote number */
- Boolean rulerShowing; /* if TRUE, ruler is showing */
- Boolean doubleSided; /* if TRUE, document has Left/Right pages */
- Boolean titlePage; /* If TRUE, document has a title page (with no headers/footers) */
- Boolean endnotes; /* If TRUE, footnotes are displayed as endnotes */
- Boolean showInvisibles; /* If TRUE, invisible characters are displayed */
- Boolean showPageGuides; /* If TRUE, page guides are displayed */
- Boolean showPictures; /* If TRUE, pictures are displayed */
- Boolean autoFootnotes; /* If TRUE, footnotes are numbered automatically */
- Boolean footnotesExist; /* If TRUE, footnotes are being exported */
- THPrint printRecord; /* Print record for this document */
- Point pagePoint; /* Point where page number is displayed in header or footer */
- Point datePoint; /* Point where date character is displayed in header or footer */
- Point timePoint; /* Point where time character is displayed in header or footer */
- Boolean smartQuotes; /* If TRUE, SmartQuotes are turned on */
- Boolean fractCharWidths;/* If TRUE, fractional character widths are turned on */
- short hRes; /* The horizontal resolution of this document */
- short vRes; /* The vertical resolution of this document */
- Rect windowRect; /* Rectangle specifying document window placement and size */
- SFReply theReply; /* Standard reply record describing the file being written */
- TransDescribe thisTranslator; /* TransDescribe record describing this translator */
- };
- typedef struct ExportParmBlock ExportParmBlock;
- typedef ExportParmBlock *ExportParmBlkPtr;
-
- #endif
-